
import { copy } from '@/utils';
import { getArticlesList } from '@/api/article';
export default {
  state: {

    list:[],
    total:0,
  },
  reducers: {
    CAHNGE_LIST(state, { payload: { data,total } }) {
      const newState = copy(state)
      newState.list = data
      newState.total = total
      return newState
    }


  },
  reducers: {
    CAHNGE_LIST(state, { payload: { data } }) {
      const newState = copy(state);
      newState.list = data;
      return newState;
    },

  },
  effects: {
    *INIT({ pageInfo }, { put }) {
      const { data } = yield getArticlesList(pageInfo);
      yield put({

        type: "CAHNGE_LIST", payload: {
          data: data[0],
          total: data[1]
        }
      })
    }
  },
  subsriptions: {
    init(){}
  }
}




